package com.example.core.form;

import com.example.core.convert.FormToModelPropertyMap;
import com.example.core.convert.form.FormConvertor_IDToModel;
import com.example.core.convert.form.FormConvertor_IDToModelList;
import com.example.core.model.BaseAuthModel;
import com.example.sys.org.model.SysOrgElement;
import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public abstract class BaseAuthForm extends BaseForm<BaseAuthForm> {

    private String fdReaderIds;

    private String fdReaderNames;

    private String fdEditersIds;

    private String fdEditersNames;

    private String fdDeletersIds;

    private String fdDeletersNames;

    private String fdCreatorId;

    private String fdCreatorName;

    private String fdModifierId;

    private String fdModifierName;

    @Override
    public FormToModelPropertyMap getToModelPropertyMap() {
        FormToModelPropertyMap toModelPropertyMap = super.getToModelPropertyMap();
        toModelPropertyMap.put("fdCreatorId", new FormConvertor_IDToModel("fdCreator", SysOrgElement.class));
        toModelPropertyMap.put("fdModifierId", new FormConvertor_IDToModel("fdModifier", SysOrgElement.class));
        toModelPropertyMap.put("fdReaderIds", new FormConvertor_IDToModelList("sysReaders", SysOrgElement.class));
        toModelPropertyMap.put("fdEditersIds", new FormConvertor_IDToModelList("sysEditers", SysOrgElement.class));
        toModelPropertyMap.put("fdDeletersIds", new FormConvertor_IDToModelList("sysDeleters", SysOrgElement.class));
        return toModelPropertyMap;
    }

    @Override
    public Class<?> getModelClass() {
        return BaseAuthModel.class;
    }
}
